<template>
  <from>
    用户名：<input type="text" v-model="form.username">
    密码：<input type="text" v-model="form.password">
    <button @click="validate">登录</button>
  </from>
</template>

<script>
export default {
  data() {
    return {
      form: {
        username: '',
        password: '',
      }
    }
  },
  methods: {
    validate(){
      if(this.form.username=="sh"&&this.form.password=="123456"){
        alert("登录成功")
      }else{
        alert("登录失败")
      }
    }
  }
}

</script>

